package com.way.fileexplorer.adapters;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.way.fileexplorer.R;

public class CopyDestListAdapter extends BaseAdapter {

    public class ViewHolder {
        ImageView fileImg;
        TextView fileName;
    }

    private int[] imgIds = { R.drawable.main_device, R.drawable.main_sd };

    @Override
    public int getCount() {
        return imgIds.length;
    }

    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vHolder = null;
        if (convertView == null) {
            vHolder = new ViewHolder();
            convertView = LayoutInflater.from(parent.getContext()).inflate(
                    R.layout.copydest_listitem, null);
            vHolder.fileImg = (ImageView) convertView
                    .findViewById(R.id.file_item_list_img);
            vHolder.fileName = (TextView) convertView
                    .findViewById(R.id.file_item_list_name);
            vHolder.fileName.setText(parent.getResources().getStringArray(
                    R.array.select_dest)[position]);
            vHolder.fileImg.setImageResource(imgIds[position]);
            convertView.setTag(vHolder);
        } else {
            vHolder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }
}
